/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Persistencia;

import Objetos.Parcela;
import DAO.AccessDatabase;
import Objetos.Usuario;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author celiobj
 */
public class RepositorioParcela implements RepositorioParcelaInterface {

    @Override
    public void inserirParcela(Parcela parcela,Usuario usu) {

        try {

            AccessDatabase a = new AccessDatabase();
            Connection con = a.conectar();
            Statement st = con.createStatement();
            st.execute("INSERT INTO `parcelas` (`idpedido`, `idcliente`, `idcondicao`, `valorparcela`, `descricaoparcela`, `dataPagparcela`, `tipo`) VALUES ('" + parcela.getCod_pedido() + "', '" + parcela.getCod_cliente() + "', '" + parcela.getCod_condicao() + "', '" + parcela.getValor() + "', '" + parcela.getDescricao() + "', '" + parcela.getData_pagamento() + "', '" + parcela.getTipo() + "');");
        } catch (SQLException ex) {
            Logger.getLogger(RepositorioUsuario.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    @Override
    public void cancelarParcela(Parcela parcela,Usuario usu) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public Parcela procurarParcela(String cod_parcela,Usuario usu) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

}
